import axios from 'axios'
export function requestQueryPlan(config, baseURL) {
  const instance = axios.create({
    baseURL: baseURL,
    timeout: 1800000
  })
  instance.interceptors.request.use(config => {
    //config.headers.Authorization="Bearer"+store.state.oidcStore.access_token
    //config.headers.Authorization=window.sessionStorage.getItem('token') 
    //config.headers.PaginationHeader="X-Pagination"
    return config
  }, error => {
    console.log(err)
  })
  instance.interceptors.response.use(res => {
    return res
  }, err => {
    console.log(err);
  })
  return instance(config)
}

export function getFlypaths(baseURL) {
  return requestQueryPlan({
    method: 'get',
    url: 'flypaths'
  }, baseURL)
}

export function getFlights(baseURL) {
  return requestQueryPlan({
    method: 'get',
    url: 'flights'
  }, baseURL)
}
